package designPattern.structure7.Flyweight.chapter23_flyweight.test23_5;

public class Application {
    public static void main(String args[]) {
        ElementFactory factory = ElementFactory.getFactory();
        Element element;


        element = factory.getElement("CO");
        Compound compound1 = new Compound(element, "一氧化碳", 1, 1);
        Compound compound2 = new Compound(element, "二氧化碳", 1, 2);

        element = factory.getElement("HO");
        Compound compound3 = new Compound(element, "水", 2, 1);
        Compound compound4 = new Compound(element, "过氧化氢", 2, 2);


        compound1.print();
        compound2.print();
        compound3.print();
        compound4.print();

    }
}

